import express from 'express';
import * as pickUpController from './pickUp.controller';
import { validateLoginData, authGuard, userGuard } from '../auth/auth.middleware';

const router = express.Router();

/**
 * 获取内容
 */
router.get('/pickUp', userGuard, pickUpController.index);

/**
 * 获取内容(按 ID)
 */
router.get('/pickUp/:postId', userGuard, pickUpController.pickUpDetail);

/**
 * 按关键字查询（模糊查询）
 */
router.get('/getPickUpByKey', pickUpController.selectByKey);

/**
 * 创建内容
 */
router.post('/pickUp', authGuard, pickUpController.store);

/**
 * 更新内容
 */
router.patch('/pickUp/:postId', authGuard, pickUpController.update);

/**
 * 删除内容 
 */
router.delete('/pickUp/:postId', authGuard, pickUpController.destroy);
router.post('/pickUpDestroy', authGuard, pickUpController.destroy);

/**
 * 修改状态
 */
router.patch('/pickUpStatus/:postId', authGuard, pickUpController.status);

export default router;
